package myufferdStresmDmo1;

import java.io.*;

/**
 * ClassName:    BufferedStreamDemo1
 * Description:  缓冲流演示
 * Author:       于子续
 * Date:         2024/10/10 上午9:16
 * Version:      1.0
 **/
public class BufferedStreamDemo1 {
    public static void main(String[] args) throws IOException {

        // 创建缓冲流对象
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("a.txt"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("copy.txt"));

        //循环读取并写入目的地
        int b;
        while (((b = bis.read()) != -1)) {
            bos.write(b);
        }
        // 关闭流
        bos.close();
        bis.close();
    }
}
